package com.controller.seedoctor;


import com.comm.R;
import com.comm.vo.DoctorShiftsParams;
import com.entity.DoctorShifts;
import com.service.seedoctor.DoctorShiftService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/seeDoctor/Scheduling")
@Api(value = "医生排班",tags = "医生排班")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方法错误"),
        @ApiResponse(code=500,message="后台服务错误")
})
public class DoctorShiftsController {



    @Autowired
    private DoctorShiftService doctorService;
    /**
     * 获得所有医生的基本信息
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/getAllDoctor")
    @ApiOperation(value = "获取所有医生基本信息",notes = "获取所有医生")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页的条数",paramType = "query",dataType = "int",required = true),

    })
    public R getAllDoctor(String currentPage,String  pageSize){


        R r = doctorService.returnAllDoctorInfo(currentPage,pageSize);
        return r;


    }


    /**
     * 获取在该周所有医生的值班信息
     * @param
     * @param
     * @return
     */
    @GetMapping("/getAllDoctorShiftsByDate")
    @ApiOperation(value = "获取在该周所有医生的值班信息",notes = "医生排班信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startDate",value = "一周的开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endDate",value = "一周的结束时间",paramType = "query",dataType = "String",required = true),

    })
    public R getAllDoctorShiftsByDate(@RequestBody DoctorShiftsParams params){

        return doctorService.getAllDoctorsShiftInfoInAWeek(params);
    }


    /**
     * 通过该医生的id拿到该医生在这一周的值班信息,以张学友在2-13到2-19为例
     * @param
     * @return
     */
    @GetMapping("/getInfoByDoctorId")
    @ApiOperation(value = "通过该医生的id拿到该医生在这一周的值班信息,以张学友在2-13到2-19为例",notes = "编辑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "doctorId",value = "通过医生的id拿到该医生在该时段的所有值班信息",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "startDate",value = "一周的开始时间",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "endDate",value = "一周的结束时间",paramType = "query",dataType = "String",required = true),

    })
    public R getInfoByDoctorId(@RequestBody DoctorShiftsParams params){
        return doctorService.getOneDoctorShilfInfo(params);
    }


    /**
     * 获取挂号类型
     * @return
     */

    @GetMapping("/getRegistrationFee")
    @ApiOperation(value = "获取挂号类型",notes = "挂号类型")
    public R getGuaHaoType(){

        return doctorService.getRegistrationFee();
    }

    /**
     * 确定按钮，用于提交排班信息，或者更改排班信息
     * @return
     */

    @PostMapping("/updateDoctorShifts")
    @ApiOperation(value = "确定按钮，用于提交排班信息，或者更改排班信息",notes = "确定")
    public R  updateDoctorShifts(@RequestBody @ApiParam(name = "vo" ,value = "确定按钮需要提交的数据" ,required = true)List<DoctorShifts> shifts) {

        return doctorService.updateDoctorShifts(shifts);


    }
}
